home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
076-100
/
disk_098
/
thai
/
scan.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
4KB
|
170 lines
#include "quiz.h"
reset_next_prev ()
{
#ifdef USE_ON_OFF
if ( more ( PREV_ENTRY ) )
OnGadget ( &CmdGadget[ PREV_ENTRY ] , window , (LONG)NULL );
else
OffGadget ( &CmdGadget[ PREV_ENTRY ] , window , (LONG)NULL );
if ( more ( NEXT_ENTRY ) )
OnGadget ( &CmdGadget[ NEXT_ENTRY ] , window , (LONG)NULL );
else
OffGadget ( &CmdGadget[ NEXT_ENTRY ] , window , (LONG)NULL );
#endif
}
more ( direction )
int direction;
{
char *p;
switch ( scanning ) {
case CHOOSE_SENTENCE :
p = wordptr;
if ( direction == PREV_ENTRY ) {
if ( p == chosen_sentence->thai )
return ( FALSE );
else
return ( TRUE );
}
else {
while ( *p != TC_SPACE && *p != '\0' )
p++;
return ( *p == TC_SPACE );
}
case TS_SEARCH :
return ( thai_search ( chosen_sentence , screen_sentence.thai ,
direction ) != NULL );
case PS_SEARCH :
return ( phonetic_search ( chosen_sentence , screen_sentence.phonetic ,
direction ) != NULL );
case ES_SEARCH :
return ( english_search ( chosen_sentence , screen_sentence.english ,
direction ) != NULL );
case TW_SEARCH :
return ( thai_search ( chosen_word , screen_word.thai ,
direction ) != NULL );
case PW_SEARCH :
return ( phonetic_search ( chosen_word , screen_word.phonetic ,
direction ) != NULL );
case EW_SEARCH :
return ( english_search ( chosen_word , screen_word.english ,
direction ) != NULL );
}
return ( FALSE );
}
do_scan ( direction )
int direction;
{
char *p;
char oldc;
switch ( scanning ) {
case CHOOSE_WORD :
if ( direction == PREV_ENTRY ) {
if ( cur_split_word > 0 )
cur_split_word--;
}
else {
if ( cur_split_word + 1 < num_split_words )
cur_split_word++;
}
if ( cur_split_word < num_split_words && cur_split_word >= 0 )
new_word ( split_words[ cur_split_word ] );
break;
case TS_SEARCH :
new_sentence ( thai_search ( chosen_sentence , scan.thai ,
direction ) );
break;
case PS_SEARCH :
new_sentence ( phonetic_search ( chosen_sentence , scan.phonetic ,
direction ) );
break;
case ES_SEARCH :
new_sentence ( english_search ( chosen_sentence , scan.english ,
direction ) );
break;
case TW_SEARCH :
new_word ( thai_search ( chosen_word , scan.thai , direction ) );
break;
case PW_SEARCH :
new_word ( phonetic_search ( chosen_word , scan.phonetic ,
direction ) );
break;
case EW_SEARCH :
new_word ( english_search ( chosen_word , scan.english ,
direction ) );
break;
}
}
new_sentence ( sentence )
struct thai_phrase *sentence;
{
if ( sentence == NULL )
chosen_sentence = &sentence_head;
else
chosen_sentence = sentence;
if ( show_sentence & SHOW_THAI )
strcpy ( screen_sentence.thai , chosen_sentence->thai );
else
screen_sentence.thai[0] = '\0';
if ( show_sentence & SHOW_PHONETIC )
strcpy ( screen_sentence.phonetic , chosen_sentence->phonetic );
else
screen_sentence.phonetic[0] = '\0';
if ( show_sentence & SHOW_ENGLISH )
strcpy ( screen_sentence.english , chosen_sentence->english );
else
screen_sentence.english[0] = '\0';
RefreshGadgets ( window->FirstGadget , window , (LONG)NULL );
redraw_thai ( TS_ENTRY );
}
new_word ( word )
struct thai_phrase *word;
{
if ( word == NULL )
chosen_word = &word_head;
else
chosen_word = word;
if ( show_word & SHOW_THAI )
strcpy ( screen_word.thai , chosen_word->thai );
else
screen_word.thai[0] = '\0';
if ( show_word & SHOW_PHONETIC )
strcpy ( screen_word.phonetic , chosen_word->phonetic );
else
screen_word.phonetic[0] = '\0';
if ( show_word & SHOW_ENGLISH )
strcpy ( screen_word.english , chosen_word->english );
else
screen_word.english[0] = '\0';
RefreshGadgets ( window->FirstGadget , window , (LONG)NULL );
redraw_thai ( TW_ENTRY );
}